/**
 * @Company: 北京慧点科技有限公司 | www.smartdot.com.cn
 * @Copyright 1998-2020 © Smartdot Technologies Co., Ltd.
 */
package com.springlearn.zhoufei.other.spring.demo2;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Import;

@Configurable // 相当于Bean2.xml
@Import({ HelloWorld8_1.class, HelloWorld6_1.class }) // 相當于把HelloWorld8_1和HelloWorld6_1配置的bean放到HelloWorld9中
public class HelloWorld9 {
    
    public static void main(String[] args) {
        // 当实例化上下文时，不需要同时指定HelloWorld8_1.class和HelloWorld6_1.class，只有HelloWorld9类需要提供
        ApplicationContext context = new AnnotationConfigApplicationContext(HelloWorld9.class);
        
        HelloWorld8 HelloWorld8 = context.getBean(HelloWorld8.class);
        System.out.println(HelloWorld8.toString());
        System.out.println(HelloWorld8.getHelloWorld7().toString());
        
    }
}